<!doctype html>
<html class="no-js">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="description" content="">
  <meta name="keywords" content="">
  <meta name="viewport"
        content="width=device-width, initial-scale=1">
  <title>新码支付</title>

  <!-- Set render engine for 360 browser -->
  <meta name="renderer" content="webkit">

  <!-- No Baidu Siteapp-->
  <meta http-equiv="Cache-Control" content="no-siteapp"/>
  <link rel="icon" href="favicon.ico" />

  <script src="../public/all/js/jquery-3.1.1.min.js"></script>
  <script src="../public/all/js/amazeui.min.js"></script>
  <script src="../public/all/js/jquery.cookie.js"></script>
  <script src="js/login.min.js"></script>

  <!-- debug only -->
  <script src="../public/all/js/jquery.nivo.slider.js"></script>
  <script src="../public/all/layer/layer.js"></script>

  <script src="../public/all/js/context.js"></script>
  <script src="../public/all/js/util.js"></script>
  <script src="../public/all/js/cmd.js"></script>
  <script src="js/app.js"></script>
  <script src="../public/all/js/classify.js"></script>
  <script src="../public/all/js/page.js"></script>
  <script src="../public/all/js/rule/rule.js"></script>

  <script src="../public/all/js/me.js"></script>
  <!-- debug only end -->
</head>
<body>
    <div class="qrcode">数据提交中，请稍后……</div>

    <div id="heyifuu" style="display:none;">
        <form id="form-hidden" action="https://www.xinmapay.com:7301/jhpayment" method="post">
            <div></div>
            <input type="submit" value="提交"/>
        </form>
    </div>

    <script type="text/javascript">
        var key = urlInfo.params.key, amount = urlInfo.params.amount, payType = urlInfo.params.payType || '';
        var source = urlInfo.params.source;
        var channel3 = 'bank';
        if (payType == '20') channel3 = 'alipay';
        else if (payType == '10') channel3 = 'wechat';
        else if (payType == '50') channel3 = 'qq';
        else payType == null;

        // 新码扫码支付
        if (source == 'qr') {
            CMD.pay_xinmapay_create_qr(key, amount * 100, payType, "goods", channel3, function(r) {
                if (!r) {
                    alert("请求失败，请重新尝试。");
                    return;
                }

                // 生成二维码
                var url = '<img src="http://qr.liantu.com/api.php?text=__v__"/>';
                url = url.replace(/__v__/, encodeURIComponent(r));
                $(".qrcode").empty();
                $(".qrcode").append(url);
            });
        }
        else if (source == 'pc') {
            CMD.pay_xinmapay_create_pc(key, amount * 100, payType, "goods", channel3, function(r) {
                console.log("xxxx", r);

                var heyifuu = r;
                for (var k in heyifuu) {
                    var l = '__k__<input type="text" name="__k__" value="__v__"><br>';
                    l = l.replace(/__k__/g, k);
                    l = l.replace(/__v__/g, heyifuu[k]);
                    $("#form-hidden div").append(l);	
                }
                //$("#form-hidden").submit();
            });
        }
    </script>
</body>
</html>
<style type="text/css">
.qrcode {
    text-align: center;
    padding-top: 20px;
}
.qrcode img {
    width: 250px;
    height: 250px;
}
</style>
